﻿using System;
using System.Collections.Generic;

namespace Talented.Core.Entities.Talents.Stats.Abstract
{
	public abstract class StatBase
	{
		#region Enums
		[Flags]
		public enum PropertyEnum
		{
			NotUpgradeable
		}
		#endregion

		#region Properties
		public StatEnum Type { get; protected set; }
		public PropertyEnum Properties { get; protected set; }
		public byte Position { get; set; }
		public double InitialValue { get; set; }
		public double[] UpgradeSequence { get; set; }
		public double UpgradeFactor { get; set; }
		#endregion

		#region Constructors
		protected StatBase(StatEnum type, PropertyEnum properties)
		{
			Type = type;
			Properties |= properties;
		}

		protected StatBase(StatEnum type, PropertyEnum properties, byte position, double initialValue, double[] upgradeSequence, double upgradeFactor)
			: this(type, properties)
		{
			Position = position;

			if (initialValue < 0)
				throw new ArgumentOutOfRangeException("initialValue");
			InitialValue = initialValue;

			if (upgradeSequence == null)
				throw new ArgumentNullException("upgradeSequence");
			UpgradeSequence = upgradeSequence;

			if (upgradeFactor < 0)
				throw new ArgumentOutOfRangeException("upgradeFactor");
			UpgradeFactor = upgradeFactor;
		}
		#endregion

		#region Methods
		public abstract StatResult Upgrade();
		#endregion
	}
}
